<template>
  <div class="box">
    <el-form :model="ruleForm" ref="ruleForm" label-width="100px" class="demo-ruleForm">
  <el-form-item label="账号" prop="name">
    <el-input v-model="ruleForm.user"></el-input>
  </el-form-item>
  <el-form-item label="密码" prop="name">
    <el-input v-model="ruleForm.pass"></el-input>
  </el-form-item>
  <el-form-item>
    <el-button type="primary" @click="submitForm">登录</el-button>
  </el-form-item>
</el-form>
  </div>
</template>

<script>
  export default {
    data() {
      return {
        yonghu:{
          user:'18219406523',
          pass:'123456'
        },
        ruleForm: {
          user:'',
          pass:''
        },
      };
    },
    methods: {
      submitForm() {
          if (this.ruleForm.user === this.yonghu.user && this.ruleForm.pass === this.yonghu.pass) {
            alert('登录成功');
            this.$router.push('/user')
          } else {
            alert('账号或密码有误');
            return false;
          }
      },
    }
  }
</script>

<style lang="scss" scoped>
  .box{
    width: 500px;
    height: 500px;
    margin: auto;
    border: solid 1px blue;
    padding: 20px;
  }
</style>
